<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 子串能表示从 1 到 N 数字的二进制串 -->
    <script>
      var queryString = function (S, N) {
        let i = 0
        while (++i <= N) {
          if (S.indexOf(i.toString(2)) === -1) return false
        }
        return true
      }
      console.log(queryString('0110', 3))
    </script>
  </body>
</html>
